'use strict'
const {app, globalShortcut } = require('electron')
const {resolve} = require('path')
function initGlobalBus(){
    //全局事件总线
    global.$bus = require('pubsub-js')
    //全局渲染文件根路径
    if(app.isPackaged){
        global.$baseUrl = `file://${resolve(__dirname,'src')}`
    }else{
        global.$baseUrl = `file://${resolve(process.cwd(),'src')}`
    }
    //global.$baseUrl = `http://localhost:8080`
}
function initGlobalShort() {
    globalShortcut.register('CommandOrControl+Q', () => {
        //快捷键操作
    })
    app.on('will-quit', () => {
        globalShortcut.unregisterAll()
    })
}
module.exports = {initGlobalBus,initGlobalShort}